curl --request POST \
--url https://api.topsort.com/public/v1/toptimize/forecasting/campaign \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"campaignFormat": "listing",
"dailyBudget": 123,
"dateRange": {
"startDate": "2023-12-25",
"endDate": "2023-12-25"
},
"targetRoas": 123,
"campaignType": "autobidding",
"products": [
{
"id": "<string>"
}
],
"triggers": [
{
"value": "<string>"
}
],
"targets": []
}
'import requests
url = "https://api.topsort.com/public/v1/toptimize/forecasting/campaign"
payload = {
"campaignFormat": "listing",
"dailyBudget": 123,
"dateRange": {
"startDate": "2023-12-25",
"endDate": "2023-12-25"
},
"targetRoas": 123,
"campaignType": "autobidding",
"products": [{ "id": "<string>" }],
"triggers": [{ "value": "<string>" }],
"targets": []
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
campaignFormat: 'listing',
dailyBudget: 123,
dateRange: {startDate: '2023-12-25', endDate: '2023-12-25'},
targetRoas: 123,
campaignType: 'autobidding',
products: [{id: '<string>'}],
triggers: [{value: '<string>'}],
targets: []
})
};
fetch('https://api.topsort.com/public/v1/toptimize/forecasting/campaign', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.topsort.com/public/v1/toptimize/forecasting/campaign",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'campaignFormat' => 'listing',
'dailyBudget' => 123,
'dateRange' => [
'startDate' => '2023-12-25',
'endDate' => '2023-12-25'
],
'targetRoas' => 123,
'campaignType' => 'autobidding',
'products' => [
[
'id' => '<string>'
]
],
'triggers' => [
[
'value' => '<string>'
]
],
'targets' => [
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.topsort.com/public/v1/toptimize/forecasting/campaign"
payload := strings.NewReader("{\n \"campaignFormat\": \"listing\",\n \"dailyBudget\": 123,\n \"dateRange\": {\n \"startDate\": \"2023-12-25\",\n \"endDate\": \"2023-12-25\"\n },\n \"targetRoas\": 123,\n \"campaignType\": \"autobidding\",\n \"products\": [\n {\n \"id\": \"<string>\"\n }\n ],\n \"triggers\": [\n {\n \"value\": \"<string>\"\n }\n ],\n \"targets\": []\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.topsort.com/public/v1/toptimize/forecasting/campaign")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"campaignFormat\": \"listing\",\n \"dailyBudget\": 123,\n \"dateRange\": {\n \"startDate\": \"2023-12-25\",\n \"endDate\": \"2023-12-25\"\n },\n \"targetRoas\": 123,\n \"campaignType\": \"autobidding\",\n \"products\": [\n {\n \"id\": \"<string>\"\n }\n ],\n \"triggers\": [\n {\n \"value\": \"<string>\"\n }\n ],\n \"targets\": []\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.topsort.com/public/v1/toptimize/forecasting/campaign")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"campaignFormat\": \"listing\",\n \"dailyBudget\": 123,\n \"dateRange\": {\n \"startDate\": \"2023-12-25\",\n \"endDate\": \"2023-12-25\"\n },\n \"targetRoas\": 123,\n \"campaignType\": \"autobidding\",\n \"products\": [\n {\n \"id\": \"<string>\"\n }\n ],\n \"triggers\": [\n {\n \"value\": \"<string>\"\n }\n ],\n \"targets\": []\n}"
response = http.request(request)
puts response.read_body{
"forecasts": {
"impressions": {
"forecastValue": 150000,
"forecastIntervalMin": 142000,
"forecastIntervalMax": 158000
},
"clicks": {
"forecastValue": 12500,
"forecastIntervalMin": 11800,
"forecastIntervalMax": 13200
},
"purchases": {
"forecastValue": 875,
"forecastIntervalMin": 820,
"forecastIntervalMax": 930
},
"sales": {
"forecastValue": 52500,
"forecastIntervalMin": 49000,
"forecastIntervalMax": 56000
},
"adSpend": {
"forecastValue": 10500,
"forecastIntervalMin": 10000,
"forecastIntervalMax": 11000
}
}
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}[BETA] Campaign Performance Forecasts
Get campaign performance forecasts with confidence intervals.
⚠️ Beta Access Required
Contact your sales representative to gain access to this endpoint and start using it.
Currently Supported:
- Listing campaigns (autobidding) only
Returns total campaign forecasts (not daily) for:
- Total impressions with confidence intervals
- Total clicks with confidence intervals
- Total purchases with confidence intervals
- Total sales with confidence intervals
- Total ad spend with confidence intervals
Constraints:
- Date range cannot exceed 31 days.
curl --request POST \
--url https://api.topsort.com/public/v1/toptimize/forecasting/campaign \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"campaignFormat": "listing",
"dailyBudget": 123,
"dateRange": {
"startDate": "2023-12-25",
"endDate": "2023-12-25"
},
"targetRoas": 123,
"campaignType": "autobidding",
"products": [
{
"id": "<string>"
}
],
"triggers": [
{
"value": "<string>"
}
],
"targets": []
}
'import requests
url = "https://api.topsort.com/public/v1/toptimize/forecasting/campaign"
payload = {
"campaignFormat": "listing",
"dailyBudget": 123,
"dateRange": {
"startDate": "2023-12-25",
"endDate": "2023-12-25"
},
"targetRoas": 123,
"campaignType": "autobidding",
"products": [{ "id": "<string>" }],
"triggers": [{ "value": "<string>" }],
"targets": []
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
campaignFormat: 'listing',
dailyBudget: 123,
dateRange: {startDate: '2023-12-25', endDate: '2023-12-25'},
targetRoas: 123,
campaignType: 'autobidding',
products: [{id: '<string>'}],
triggers: [{value: '<string>'}],
targets: []
})
};
fetch('https://api.topsort.com/public/v1/toptimize/forecasting/campaign', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.topsort.com/public/v1/toptimize/forecasting/campaign",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'campaignFormat' => 'listing',
'dailyBudget' => 123,
'dateRange' => [
'startDate' => '2023-12-25',
'endDate' => '2023-12-25'
],
'targetRoas' => 123,
'campaignType' => 'autobidding',
'products' => [
[
'id' => '<string>'
]
],
'triggers' => [
[
'value' => '<string>'
]
],
'targets' => [
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.topsort.com/public/v1/toptimize/forecasting/campaign"
payload := strings.NewReader("{\n \"campaignFormat\": \"listing\",\n \"dailyBudget\": 123,\n \"dateRange\": {\n \"startDate\": \"2023-12-25\",\n \"endDate\": \"2023-12-25\"\n },\n \"targetRoas\": 123,\n \"campaignType\": \"autobidding\",\n \"products\": [\n {\n \"id\": \"<string>\"\n }\n ],\n \"triggers\": [\n {\n \"value\": \"<string>\"\n }\n ],\n \"targets\": []\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.topsort.com/public/v1/toptimize/forecasting/campaign")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"campaignFormat\": \"listing\",\n \"dailyBudget\": 123,\n \"dateRange\": {\n \"startDate\": \"2023-12-25\",\n \"endDate\": \"2023-12-25\"\n },\n \"targetRoas\": 123,\n \"campaignType\": \"autobidding\",\n \"products\": [\n {\n \"id\": \"<string>\"\n }\n ],\n \"triggers\": [\n {\n \"value\": \"<string>\"\n }\n ],\n \"targets\": []\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.topsort.com/public/v1/toptimize/forecasting/campaign")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"campaignFormat\": \"listing\",\n \"dailyBudget\": 123,\n \"dateRange\": {\n \"startDate\": \"2023-12-25\",\n \"endDate\": \"2023-12-25\"\n },\n \"targetRoas\": 123,\n \"campaignType\": \"autobidding\",\n \"products\": [\n {\n \"id\": \"<string>\"\n }\n ],\n \"triggers\": [\n {\n \"value\": \"<string>\"\n }\n ],\n \"targets\": []\n}"
response = http.request(request)
puts response.read_body{
"forecasts": {
"impressions": {
"forecastValue": 150000,
"forecastIntervalMin": 142000,
"forecastIntervalMax": 158000
},
"clicks": {
"forecastValue": 12500,
"forecastIntervalMin": 11800,
"forecastIntervalMax": 13200
},
"purchases": {
"forecastValue": 875,
"forecastIntervalMin": 820,
"forecastIntervalMax": 930
},
"sales": {
"forecastValue": 52500,
"forecastIntervalMin": 49000,
"forecastIntervalMax": 56000
},
"adSpend": {
"forecastValue": 10500,
"forecastIntervalMin": 10000,
"forecastIntervalMax": 11000
}
}
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}Autorizações
A valid API key generated in Topsort's UI. Use the TSE API key if calling auctions or events API, otherwise use the TSC API key.
Corpo
Public API request for a listing campaign performance forecast.
Campaign format type. Currently only 'listing' is supported.
listing Daily budget for the campaign
Campaign date range
Show child attributes
Show child attributes
Target Return on Ad Spend
Campaign type (required)
autobidding List of products in the campaign (required)
1Show child attributes
Show child attributes
List of campaign triggers (optional, defaults to empty list)
Show child attributes
Show child attributes
Optional list of target variables to forecast. If not provided, all targets will be forecasted.
ad_spend, clicks, impressions, purchases, sales Resposta
Successful Response
Campaign performance forecasts
Show child attributes
Show child attributes
Esta página foi útil?